package com.miaosha.redis.list;

import redis.clients.jedis.Jedis;

import java.util.List;

/**
 * @author lsq
 * @create 2021-10-16 11:47
 * @description
 * @menu
 **/
public class SendMailDemo {

    private Jedis jedis = new Jedis("182.42.113.98", 6379);

    /**
     * 让发送邮件任务入队列
     *
     * @param sendMailTask
     */
    public void enqueueSendMailTask(String sendMailTask) {
        jedis.lpush("send_mail_task_queue", sendMailTask);
    }

    public List<String> taskSendMailTask() {
        return jedis.brpop(5000, "send_mail_task_queue");
    }
}
